<template>
    <view id="seller-item-list" style="position: relative;">
        <!-- 正常的页头 -->
        <custom :float="true" v-if="common_data.item_search.show == false && common_data.item_info_dialog.show != true">
            <template #right>
                <view class="margin-right-30">
                    <view v-if="common_data.item_search.show == false" @tap="common_data.item_search.show = true" class="text-xl text-bold">
                        <text class="cuIcon-search"></text>
                    </view>
                </view>
            </template>
        </custom>
        <!-- 搜索页面 -->
        <view v-else-if="common_data.item_search.show == true" class="bg-white" :style="'padding-top:'+$store.state.app.status_bar">
            <view class="cu-bar search bg-white padding-lr-30 flex align-center" style="height: 120rpx;">
                <view class="text-bold text-xxl" @tap="common_data.item_search.show = false">
                    <text class="cuIcon-back_android"></text>
                </view>
                <view class="search-form round border-1-nddyny" style="height: 72rpx; margin-left: 20rpx; margin-right: 20rpx;">
                    <text class="cuIcon-search"></text>
                    <input @input="(e)=>{common_data.item_search.inputValue = e.target.value}" style="font-size: 28rpx;"
                        placeholder="搜一搜商品" confirm-type="search"></input>
                </view>
                <view class="text-lg" @tap="common_data.item_search.value = common_data.item_search.inputValue">
                    <text>搜索</text>
                </view>
            </view>
            <!-- 搜索到的商品列表 -->
            <itemList ref="search" :buy_mode="buy_mode" :seller_user_id="seller_user_id" :cart_item_list="refsCartPageCartItemList"
                :is_search_list="true" :search_value.sync="common_data.item_search.value" :item_list_info.sync="searchItemListInfo"
                :itemAttrDialogShow="itemAttrDialogShow" :itemInfoDialogShow="itemInfoDialogShow" :itemAttrCartUpdate="itemAttrCartUpdate"></itemList>
        </view>
        <!-- 主页面 -->
        <view v-show="common_data.item_search.show == false">
            <!-- 在页面最上面显示商家信息的组件 -->
            <list_sellerInfoCard :seller_user_id="seller_user_id" :sa_id="sa_id" :params="params" :seller_info="common_data.seller_info"></list_sellerInfoCard>
            <!-- 用来切换是显示商品列表还是商家信息的tab -->
            <view id="seller_tab" class="bg-white padding-top-40 padding-bottom-30 padding-lr-30 text-lg flex justify-between">
                <view>
                    <text v-for="(tab_name, tab_key) in common_data.seller_tab.list" :key="tab_key" @tap="common_data.seller_tab.cur = tab_key"
                        :class="[common_data.seller_tab.cur==tab_key?'text-bold border-bottom-2':'']" class="text-444 padding-lr-10 padding-bottom-10 margin-right-40">
                        {{tab_name}}
                    </text>
                </view>
                <view style="position: relative;">
                    <view style="position: absolute; right: 0; bottom: 0" v-if="common_data.vertical_nav.scroll_y" @tap="common_data.item_search.show = true"
                        class="text-xl text-bold">
                        <text class="cuIcon-search"></text>
                    </view>
                </view>
            </view>
            <!-- 商品列表页面 -->
            <view v-show="common_data.seller_tab.cur == 'item'" style="margin-top: -10rpx;">
                <!-- 查看自己的店铺时显示的过滤条件 -->
                <template v-if="!seller_user_id">
                    <nFormItem key="form_is_seller_is_firm" v-if="$store.state.user.identity_info.is_seller==1&&$store.state.user.identity_info.is_firm==1"
                        type="checkbox_fields" title="商品属于" :data.sync="seller_data" :checkbox_values="$store.state.user.seller_firm_checkbox_values"></nFormItem>
                    <nFormItem key="form_category_1" type="radio_list" title="商品类型" :data.sync="data" field="category_1"
                        :radio_list="common_data.seller_item_category" :is_close_btn="true"></nFormItem>
                </template>
                <!-- 用来切换不同商品列表的tab -->
                <navTabs :tab.sync="common_data.item_tab" :changeTab="key => common_data.item_tab.cur = key"></navTabs>
                <!-- 查看自己的店铺时显示的列表 -->
                <view v-if="!seller_user_id" v-show="common_data.item_tab.cur == 'item'">
                    <nFormItem key="form_user_visible_type" title="用户可见" type="radio_tag_optional" :data.sync="seller_data.all_item_list_info"
                        field="user_visible_type" :radio_values="{1: '可见', 2: '不可见'}"></nFormItem>
                    <nFormItem key="form_buy_mode_field" title="配送" title_em="2" type="radio_tag_optional" :data.sync="seller_data"
                        field="buy_mode_field" :radio_values="$store.state.user.dict_to_shop_same_city_express"></nFormItem>
                    <nFormItem key="form_item_type_id" title="分类" title_em="2" type="radio_tag_optional" :data.sync="seller_data"
                        field="item_type_id" :radio_values="seller_data.all_item_list_info.item_type_radio_values"></nFormItem>
                    <nFormItem key="form_search_value" title="搜索商品" title_em="4" placeholder="请填写要搜索的商品" :data.sync="seller_data"
                        field="search_value"></nFormItem>
                    <itemList ref="item" key="item" :cart_item_list="refsCartPageCartItemList" :itemAttrDialogShow="itemAttrDialogShow"
                        :itemInfoDialogShow="itemInfoDialogShow" :itemAttrCartUpdate="itemAttrCartUpdate"
                        :seller_user_id="seller_user_id" :item_list_info.sync="seller_data.all_item_list_info"></itemList>
                    <foot :content="[{
                        'title': '全国邮费',
                        'class': 'bg-nddyny light basis-25',
                        'uri': '/seller/item/mailPrice/list'
                    },{
                        'title': '发货渠道',
                        'class': 'bg-nddyny basis-25',
                        'uri': '/seller/item/sendChannelList'
                    },{
                        'title': '商品分类',
                        'class': 'bg-deep-nddyny basis-25',
                        'uri': '/seller/item/typeList'
                    },{
                        'title': '添加商品',
                        'class': 'bg-gradual-nddyny basis-30',
                        'uri': '/seller/item/info'
                    }]"></foot>
                </view>
                <!-- 全国邮寄列表 -->
                <itemList ref="is_express" key="is_express" v-if="common_data.item_tab.cur == 'is_express'"
                    :cart_item_list="refsCartPageCartItemList" item_list_tab="is_express" :itemAttrDialogShow="itemAttrDialogShow"
                    :itemInfoDialogShow="itemInfoDialogShow" :itemAttrCartUpdate="itemAttrCartUpdate" :seller_user_id="seller_user_id"
                    :item_list_info.sync="common_data.is_express_list_info" :vertical_nav_scroll_y.sync="common_data.vertical_nav.scroll_y"></itemList>
                <!-- 同城配送列表 -->
                <itemList ref="is_same_city" key="is_same_city" v-if="common_data.item_tab.cur == 'is_same_city'"
                    :cart_item_list="refsCartPageCartItemList" item_list_tab="is_same_city" :itemAttrDialogShow="itemAttrDialogShow"
                    :itemInfoDialogShow="itemInfoDialogShow" :itemAttrCartUpdate="itemAttrCartUpdate" :seller_user_id="seller_user_id"
                    :item_list_info.sync="common_data.is_same_city_list_info" :vertical_nav_scroll_y.sync="common_data.vertical_nav.scroll_y"></itemList>
                <!-- 到店自取列表 -->
                <itemList ref="is_to_shop" key="is_to_shop" v-if="common_data.item_tab.cur == 'is_to_shop'"
                    :cart_item_list="refsCartPageCartItemList" item_list_tab="is_to_shop" :itemAttrDialogShow="itemAttrDialogShow"
                    :itemInfoDialogShow="itemInfoDialogShow" :itemAttrCartUpdate="itemAttrCartUpdate" :seller_user_id="seller_user_id"
                    :item_list_info.sync="common_data.is_to_shop_list_info" :vertical_nav_scroll_y.sync="common_data.vertical_nav.scroll_y"></itemList>
                <emptyList v-if="seller_user_id && !common_data.item_tab.cur" empty_list_title="商家还没有添加商品, 您可以使用当面支付"></emptyList>
            </view>
            <!-- 显示所有半成品的商品列表，比如没选择分类的，没选择属性的 -->
            <view v-if="!seller_user_id" v-show="common_data.seller_tab.cur == 'half'" class="bg-white padding-lr-30">
                <view v-for="(info, key) in seller_data.not_item_list" :key="key" class="solid-bottom padding-tb-20 flex"
                    @tap="$store.commit('userNavTo', '/seller/item/info?item_id=' + info.item_id)">
                    <view class="padding-right-10">
                        <image class="radius-10" style="width:122rpx; height:122rpx;" :src="info.banner | ossUrl(122)"></image>
                    </view>
                    <view>
                        <view class="text-15 text-bold text-cut-2">{{info.name}}</view>
                        <view class="text-sm padding-top-10">{{info.content}}</view>
                    </view>
                </view>
            </view>
            <!-- 按库存排序的商品属性列表 -->
            <view v-if="!seller_user_id" v-show="common_data.seller_tab.cur == 'attr_amount'" class="bg-white">
                <view class="padding-lr-30">
                    <view v-for="(info, key) in seller_data.attr_amount_data.list" :key="key" class="solid-bottom padding-tb-20 flex"
                        @tap="$store.commit('userNavTo', '/seller/item/info?item_id=' + info.item_id + '&item_attr_id=' + info.item_attr_id)">
                        <view class="padding-right-10">
                            <image class="radius-10" style="width:122rpx; height:122rpx;" :src="info.logo | ossUrl(122)"></image>
                        </view>
                        <view class="flex-sub" style="width: 279rpx;">
                            <view class="text-15 text-bold text-cut-1">{{info.item_name}}</view>
                            <view>
                                <view>
                                    <view class="cu-capsule margin-top-10">
                                        <view class='cu-tag bg-red'>库存数量</view>
                                        <view class="cu-tag line-red text-bold">{{info.amount}}</view>
                                    </view>
                                </view>
                                <view v-if="info.attr_key_1" class="cu-capsule margin-top-10">
                                    <view class='cu-tag bg-nddyny'>{{info.attr_key_1}}</view>
                                    <view class="cu-tag line-nddyny">{{info.attr_value_1}}</view>
                                </view>
                                <view v-if="info.attr_key_1 && info.attr_key_2" class="cu-capsule margin-top-10">
                                    <view class='cu-tag bg-nddyny'>{{info.attr_key_2}}</view>
                                    <view class="cu-tag line-nddyny">{{info.attr_value_2}}</view>
                                </view>
                                <view v-if="info.attr_key_1 && info.attr_key_2 && info.attr_key_3" class="cu-capsule margin-top-10">
                                    <view class='cu-tag bg-nddyny'>{{info.attr_key_3}}</view>
                                    <view class="cu-tag line-nddyny">{{info.attr_value_3}}</view>
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
                <!-- tap -->
                <foot title="刷新库存列表" :tap="attrAmountListForceInit"></foot>
            </view>
            <!-- 商家信息介绍tab -->
            <list_sellerInfoPage v-show="common_data.seller_tab.cur == 'seller'" :seller_info="common_data.seller_info"></list_sellerInfoPage>
        </view>
        <foot v-if="seller_user_id && !common_data.seller_info.open_item && common_data.seller_info.open_start_time >= 0" class_bg="bg-nddyny">
            <template #content>
                <view class="text-lg text-center width-100p">
                    营业时间
                    {{common_data.seller_info.open_start_time | timeFormat('hh:mm')}}
                    -
                    {{common_data.seller_info.open_end_time | timeFormat('hh:mm')}}
                </view>
            </template>
        </foot>
        <foot v-else-if="seller_user_id && common_data.seller_tab.cur == 'item'" style_bg="#505052" zindex="701">
            <template #content>
                <view class="flex width-100p align-center text-white">
                    <view @tap="cartListShow" style="position: relative; height: 100rpx;">
                        <view class="round flex justify-center align-center" :class="[refsCartPageItemAttrLength>0?'bg-nddyny':'bg-cart-icon-gray']"
                            style="
                                height: 100rpx; width: 100rpx; 
                                position: absolute; top: -20rpx; 
                                margin-left: 20rpx;
                                border: 10rpx solid #444;
                                box-shadow: 0 0 6rpx 6rpx rgba(0,0,0,.1)
                            ">
                            <view style="line-height: 1em; font-size: 50rpx;">
                                <text class="cuIcon-cartfill"></text>
                                <view v-if="refsCartPageItemAttrLength>0" class="cu-tag badge">
                                    {{refsCartPageItemAttrLength}}
                                </view>
                            </view>
                        </view>
                    </view>
                    <view class="flex justify-between align-center width-100p" style="margin-left: 140rpx;">
                        <view class="text-gray" style="width: 400rpx;">
                            <view class="flex align-end" style="height: 58rpx;">
                                <view v-if="refsCartPageItemAttrLength==0" class="text-df padding-bottom-10" style="line-height: 1em;">未选购商品{{refsCartPageItemAttrLength}}</view>
                                <view v-else class="text-bold text-white padding-bottom-10" style="line-height: 1em;">
                                    <text>￥</text>
                                    <text class="text-xl">{{refsCartPageTotalPriceInfo.total_item_price | floor}}</text>
                                    <text v-if="refsCartPageTotalPriceInfo.total_item_price != refsCartPageTotalPriceInfo.total_item_oprice"
                                        class="text-through text-gray margin-left-10 text-13">
                                        ￥
                                        <text style="margin-left: -4rpx">{{refsCartPageTotalPriceInfo.total_item_oprice | floor}}</text>
                                    </text>
                                </view>
                            </view>
                            <view class="text-sm text-11" style="height: 42rpx; line-height: 1em;">
                                <text>包装费￥{{refsCartPageTotalPriceInfo.total_pack_price | floor}}</text>
                                <text class="margin-left-10">
                                    送金券 {{refsCartPageTotalPriceInfo.total_user_gold_coupon_amount | floor(4)}}
                                </text>
                            </view>
                        </view>
                        <view style="width: 210rpx">
                            <view v-if="refsCartPageItemAttrLength>0" @tap="gotoPay" class="cu-btn text-lg bg-nddyny"
                                style="width: 100%; height: 100rpx;">去结算</view>
                            <view v-else class="cu-btn text-lg bg-cart-submit-gray" style="width: 100%; height: 100rpx;">去结算</view>
                        </view>
                    </view>
                </view>
            </template>
        </foot>
        <!-- 显示指定商品属性选项用的，用于用户选择属性加入购物车、商家预览属性 -->
        <modalDialog ref="attr_change" :is_bottom="true" :show.sync="common_data.item_attr_dialog.show"
            :is_hide_top_cancel="true" :is_hide_top_confirm="true" :is_scroll_content="true" :is_show_top_close="true"
            :content_bottom_height="seller_user_id?'100rpx':''">
            <template #content>
                <view class="padding-tb-40 padding-lr-10">
                    <itemInfo :buy_mode="buy_mode" v-if="common_data.item_attr_dialog.item_info" :is_not_action="true"
                        :seller_user_id="seller_user_id" :item_info="common_data.item_attr_dialog.item_info"
                        :itemInfoDialogShow="itemInfoDialogShow"></itemInfo>
                    <itemAttrChange v-if="common_data.item_attr_dialog.show && common_data.item_attr_dialog.item_attr_list"
                        :itemAttrChange="itemAttrChange" :data.sync="common_data.item_attr_dialog"></itemAttrChange>
                </view>
            </template>
            <template #contentBottom>
                <view v-if="seller_user_id" class="padding-bottom-120">
                    <view class="flex justify-between padding-lr-40 padding-bottom-40">
                        <view>
                            <text class="text-15">购买数量</text>
                            <text class="text-sm text-gray margin-left-20">
                                <text>库存</text>
                                <text v-if="common_data.item_attr_dialog.item_attr_info">{{common_data.item_attr_dialog.item_attr_info.amount}}件</text>
                            </text>
                        </view>
                        <view class="flex align-center">
                            <view @tap="()=>{common_data.item_attr_dialog.input_value>0?common_data.item_attr_dialog.input_value=common_data.item_attr_dialog.input_value*1-1:''}">
                                <image style="width: 44rpx; height: 44rpx;" src="../../../static/image/common/roundsub.png"></image>
                            </view>
                            <input type="number" class="text-center text-15 text-333" style="width: 100rpx;" :value="common_data.item_attr_dialog.input_value"
                                @input="common_data.item_attr_dialog.input_value = $event.target.value*1"></input>
                            <view @tap="common_data.item_attr_dialog.input_value=common_data.item_attr_dialog.input_value*1+1">
                                <image style="width: 44rpx; height: 44rpx;" src="../../../static/image/common/roundadd.png"></image>
                            </view>
                        </view>
                    </view>
                    <nFormButton v-if="common_data.item_attr_dialog.item_attr_info && common_data.item_attr_dialog.input_value == common_data.item_attr_dialog.input_value_bak"
                        :title="'已添加过此商品，请先修改购买数量'" style_bg="#bbb" button_class="text-white" style="margin-top: -30rpx;"></nFormButton>
                    <nFormButton v-else-if="common_data.item_attr_dialog.item_attr_info && common_data.item_attr_dialog.item_attr_info.amount > 0"
                        :tap="()=>{itemAttrCartUpdate('2', common_data.item_attr_dialog.item_info, common_data.item_attr_dialog.item_attr_info.item_attr_id, common_data.item_attr_dialog.input_value)}"
                        :title="'选好了'" style="margin-top: -30rpx;"></nFormButton>
                    <nFormButton v-else :title="'请选择商品属性'" style_bg="#bbb" button_class="text-white" style="margin-top: -30rpx;"></nFormButton>
                </view>
            </template>
        </modalDialog>
        <!-- 购物车信息 -->
        <modalDialog ref="attr_cart" :is_bottom="true" :show.sync="user_data.cart.show" :is_hide_top_cancel="true"
            :is_hide_top_confirm="true" :is_scroll_content="true" :is_show_top_close="true">
            <template #content>
                <view class="padding-top-30 padding-bottom-120">
                    <view class="flex justify-between align-center padding-bottom-30">
                        <view class="text-xl">
                            <text class="cuIcon-titles text-nddyny"></text>
                            <text class="text-xl text-bold">购物车</text>
                        </view>
                        <view class="text-gray margin-right-80" @tap="user_data.cart.clear_show = true">
                            <text class="cuIcon-delete margin-right-6"></text>
                            <text>清空</text>
                        </view>
                    </view>
                    <cart ref="cart" page_type="item" :isUpdateCartCallback="setItemCommandRefreshDialog"
                        :itemInfoDialogShow="itemInfoDialogShow" :seller_user_id="seller_user_id" :cart.sync="user_data.cart"></cart>
                </view>
            </template>
        </modalDialog>
        <!-- 清空购物车 -->
        <modalDialog :show.sync="user_data.cart.clear_show" :confirm="itemAttrCartClear" content="确定要清空购物车吗？">
        </modalDialog>
        <!-- 商品详情 -->
        <itemDetail :buy_mode="buy_mode" :item_info_dialog="common_data.item_info_dialog" :cart_item_info="refsCartPageCartItemList[common_data.item_info_dialog.item_info.item_id]"
            :itemAttrDialogShow="itemAttrDialogShow" :itemInfoDialogShow="itemInfoDialogShow" :itemAttrCartUpdate="itemAttrCartUpdate"
            :seller_user_id="seller_user_id"></itemDetail>
        <!-- 需要刷新商品时触发 -->
        <modalDialog v-if="item_command_refresh_dialog.show" :is_hide_cancel="true" :show.sync="item_command_refresh_dialog.show"
            :confirm="item_command_refresh_dialog.confirm" :content="item_command_refresh_dialog.content"></modalDialog>
    </view>
</template>

<script>
    import cart from './components/cart.vue';
    import itemInfo from './components/itemInfo.vue';
    import itemList from './components/itemList.vue';
    import itemDetail from './components/itemDetail.vue';
    import itemAttrChange from './components/itemAttrChange.vue';
    import list_sellerInfoCard from './components/sellerInfoCard.vue';
    import list_sellerInfoPage from './components/sellerInfoPage.vue';
    export default {
        components: {
            cart,
            itemInfo,
            itemList,
            itemDetail,
            itemAttrChange,
            list_sellerInfoCard,
            list_sellerInfoPage,
        },
        data() {
            let vertical_nav_left_key = 'item_type_id';
            return {
                sa_id: '',
                seller_user_id: '',
                seller_type: '',
                buy_mode: '',
                is_face_pay: 0,
                params: {},
                // 初始化页面需要的数据
                data: {
                    formtag: {},
                    form: {
                        is_seller: null,
                        is_firm: null,
                        category_1: null
                    }
                },
                // 需要刷新商品时触发
                item_command_refresh_dialog: {
                    show: false,
                    content: '',
                    confirm: null,
                },
                // 用户需要的数据
                user_data: {
                    // 购物车信息
                    cart: {
                        show: false,
                        clear_show: false,
                    },
                },
                // 商家用户需要的数据
                seller_data: {
                    // 显示所有半成品的商品列表，比如没选择分类的，没选择属性的
                    not_item_list: null,
                    // 按库存排序的商品属性列表
                    attr_amount_list: null,
                    attr_amount_data: {
                        offset: 0,
                        limit: 15,
                        stop: false,
                        list: [],
                    },
                    // 查看自己的店铺时显示的列表
                    all_item_list_info: {
                        send_channel_list: null,
                        item_list: null,
                        item_list_bak: null,
                        item_type_radio_values: [],
                        formtag: {},
                        form: {
                            user_visible_type: '',
                        }
                    },
                    formtag: {},
                    form: {
                        is_seller: null,
                        is_firm: null,
                        buy_mode_field: '',
                        item_type_id: '',
                        search_value: '',
                    },
                },
                // 通用的数据
                common_data: {
                    seller_item_category: this.$dict.seller_item_category,
                    // 商家信息
                    seller_info: {},
                    // 用来切换是显示商品列表还是商家信息的tab
                    seller_tab: {
                        cur: '',
                        list: null
                    },
                    // 显示指定商品属性选项用的，用于用户选择属性加入购物车、商家预览属性
                    item_attr_dialog: {
                        show: false,
                        input_value: 1,
                        input_value_bak: 1,
                        item_info: null,
                        item_info_bak: null,
                        item_attr_info: null,
                        item_attr_list: null,
                        item_attr_list_bak: null,
                    },
                    // 用来切换不同商品列表的tab
                    item_tab: {
                        cur: '',
                        list: null
                    },
                    // 搜索页面
                    item_search: {
                        show: false,
                        inputValue: '',
                        value: '',
                    },
                    // 所有的商品
                    item_list: {},
                    // 左右联动
                    vertical_nav: {
                        // 左右联动页面能否滚动
                        scroll_y: false,
                        // 左右联动页面关联的key
                        left_key: vertical_nav_left_key,
                    },
                    // 全国邮寄列表页面
                    is_express_list_info: {
                        list_key: vertical_nav_left_key,
                        list_left: [],
                        list_right: [],
                    },
                    // 同城配送列表页面
                    is_same_city_list_info: {
                        list_key: vertical_nav_left_key,
                        list_left: [],
                        list_right: [],
                    },
                    // 到店自取列表页面
                    is_to_shop_list_info: {
                        list_key: vertical_nav_left_key,
                        list_left: [],
                        list_right: [],
                    },
                    item_info_dialog: {
                        show: false,
                        item_info: {}
                    },
                },
            };
        },
        onLoad(params) {
            this.params = params;
            this.seller_user_id = params.seller_id || params.true_seller_id || null;
            this.sa_id = params.sa_id || null;

            if (this.sa_id) {
                // 等待认领的商家
                this.seller_type = 0;
            } else if (this.seller_user_id) {
                // 用户购买商品
                this.seller_type = this.$store.state.user.is_seller_firm == 1 ? 1 : 0;
            } else {
                // 商家管理商品
                this.seller_type = params.seller_type == 1 ? 1 : 0;
            }
            // 用来切换是显示商品列表还是商家信息的tab
            this.setSellerTabList();
            // 设置商家信息，并设置需要依赖商家信息的数据
            this.setSellerInfo();
            if (this.seller_user_id) {
                // 用户购买商品 - 只初始化一次商品列表
                this.itemListInit();
            }
            this.$nextTick(() => {
                this.setVerticalNavScrollY();
            })
        },
        onShow() {
            // 如果是商家管理，则每次显示页面都刷新商品列表
            if (!this.seller_user_id) {
                this.itemListInit();
            }
        },
        onReachBottom() {
            // 如果是商家管理，并且是库存页面，并且已经设置过库存列表了
            if (!this.seller_user_id &&
                this.common_data.seller_tab.cur == 'attr_amount' &&
                this.seller_data.attr_amount_list) {
                this.attrAmountListInit(this.$api.list_action_add);
            }
        },
        onPageScroll(e) {
            this.setVerticalNavScrollY();
        },
        watch: {
            // 商家管理 - 所有的商品列表 - 选择了商品属于商家时
            'seller_data.form.is_seller'() {
                this.itemListInit();
            },
            // 商家管理 - 所有的商品列表 - 选择了商品属于企业时
            'seller_data.form.is_firm'() {
                if (this.seller_data.form.is_firm == 1 &&
                    (this.common_data.item_tab.cur != 'item' && this.common_data.item_tab.cur != 'is_express')
                ) {
                    this.common_data.item_tab.cur = 'is_express';
                }
                this.setItemTabList();
                this.itemListInit();
            },
            // 商品列表 - 选择了商品类型时
            'data.form.category_1'() {
                this.itemListInit();
            },
            // 显示或隐藏搜索页面时
            'common_data.item_search.show'(new_value) {
                this.common_data.item_search.inputValue = '';
                this.common_data.item_search.value = '';
                if (new_value == false) {
                    if (
                        this.common_data.vertical_nav.scroll_y == true &&
                        this.common_data.seller_tab.cur == 'item' && ['is_express', 'is_same_city', 'is_to_shop'].includes(
                            this.common_data.item_tab.cur)
                    ) {
                        this.$nextTick(() => {
                            uni.pageScrollTo({
                                scrollTop: 999999,
                                duration: 0
                            });
                        })
                    }
                }
            },
            // 商家管理 - 全部成品商品列表 - 选择了配送类型时
            'seller_data.form.buy_mode_field'() {
                this.searchAllItemList(this.seller_data.all_item_list_info.item_list_bak);
            },
            // 商家管理 - 全部成品商品列表 - 选择了商品分类时
            'seller_data.form.item_type_id'() {
                this.searchAllItemList(this.seller_data.all_item_list_info.item_list_bak);
            },
            // 商家管理 - 全部成品商品列表 - 搜索商品时
            'seller_data.form.search_value'() {
                this.searchAllItemList(this.seller_data.all_item_list_info.item_list_bak);
            },
            // 商品、半成品、库存、商家 tab 页面时
            'common_data.seller_tab.cur'(new_value) {
                if (!this.seller_user_id) {
                    if (new_value == 'half' && !this.seller_data.not_item_list) {
                        this.seller_data.not_item_list = {};
                        this.halfInit();
                    } else if (new_value == 'attr_amount' && !this.seller_data.attr_amount_list) {
                        this.seller_data.attr_amount_list = {};
                        this.attrAmountListInit(this.$api.list_action_page_init);
                    }
                }
                if (new_value != 'item') {
                    if (this.common_data.vertical_nav.scroll_y == true) {
                        this.$set(this.common_data.vertical_nav, 'scroll_y', false);
                    }
                } else {
                    this.setVerticalNavScrollY();
                }
            },
            // 切换商品列表页面时
            'common_data.item_tab.cur'(new_value) {
                if (!['is_express', 'is_same_city', 'is_to_shop'].includes(new_value)) {
                    if (this.common_data.vertical_nav.scroll_y == true) {
                        this.$set(this.common_data.vertical_nav, 'scroll_y', false);
                    }
                } else {
                    this.setVerticalNavScrollY();
                    this.buy_mode = this.$dict.seller_buy_mode_key2int[new_value];
                    this.$refs.cart.pageInit(new_value);
                }
            },
            // 隐藏显示购物车页面
            'user_data.cart.show'(new_value) {
                if (this.common_data.item_info_dialog.show == true) {
                    this.$set(this.common_data.item_info_dialog, 'show', false);
                    this.user_data.cart.show = true;
                }
            },
            'common_data.item_attr_dialog.input_value'(new_value, old_value) {
                if (new_value == 0) {
                    this.common_data.item_attr_dialog.input_value = old_value;
                    return;
                }
                if (this.common_data.item_attr_dialog.item_info &&
                    this.common_data.item_attr_dialog.item_info.buy_amount_min > 0 &&
                    new_value * 1 < this.common_data.item_attr_dialog.item_info.buy_amount_min * 1
                ) {
                    this.common_data.item_attr_dialog.input_value = this.common_data.item_attr_dialog.item_info.buy_amount_min;
                    return;
                }
            }
        },
        computed: {
            searchItemListInfo() {
                switch (this.common_data.item_tab.cur) {
                    case 'item':
                        return this.seller_data.all_item_list_info;
                        break;
                    case 'is_express':
                        return this.common_data.is_express_list_info;
                        break;
                    case 'is_same_city':
                        return this.common_data.is_same_city_list_info
                        break;
                    case 'is_to_shop':
                        return this.common_data.is_to_shop_list_info;
                        break;
                }
                return {};
            },
            // 购物车中的商品列表
            refsCartPageCartItemList() {
                if (!this.seller_user_id || !this.user_data.cart || !this.user_data.cart.cart_item_list) {
                    return {};
                }
                return this.user_data.cart.cart_item_list;
            },
            // 购物车中的商品属性列表
            refsCartPageCartItemAttrList() {
                if (!this.seller_user_id || !this.user_data.cart || !this.user_data.cart.cart_item_attr_list) {
                    return {};
                }
                return this.user_data.cart.cart_item_attr_list;
            },
            // 购物车中的商品属性数量
            refsCartPageItemAttrLength() {
                if (!this.seller_user_id || !this.user_data.cart || !this.user_data.cart.item_attr_length) {
                    return 0;
                }
                return this.user_data.cart.item_attr_length;
            },
            // 购物车中的价格
            refsCartPageTotalPriceInfo() {
                if (!this.seller_user_id || !this.user_data.cart || !this.user_data.cart.price_info) {
                    return {};
                }
                return this.user_data.cart.price_info;
            }
        },
        methods: {
            setVerticalNavScrollY() {
                if (
                    this.common_data.item_search.show == false && this.common_data.seller_tab.cur == 'item' && [
                        'is_express', 'is_same_city', 'is_to_shop'
                    ].includes(
                        this.common_data.item_tab.cur)
                ) {
                    uni.createSelectorQuery()
                        .in(this)
                        .select('#seller_tab')
                        .boundingClientRect(data => {
                            let seller_tab_top = data.top;
                            if (seller_tab_top * 1 <= 0 &&
                                this.common_data.vertical_nav.scroll_y == false) {
                                this.$set(this.common_data.vertical_nav, 'scroll_y', true);
                            } else if (seller_tab_top * 1 > 0 &&
                                this.common_data.vertical_nav.scroll_y == true) {
                                this.$set(this.common_data.vertical_nav, 'scroll_y', false);
                            }
                        }).exec();
                }
            },
            // 用来切换是显示商品列表还是商家信息的tab
            setSellerTabList() {
                let seller_tab_list = {};
                if (!this.sa_id) {
                    this.common_data.seller_tab.cur = 'item';
                    seller_tab_list['item'] = '商品';
                } else {
                    this.common_data.seller_tab.cur = 'seller';
                }
                if (!this.seller_user_id) {
                    seller_tab_list['half'] = '半成品';
                    seller_tab_list['attr_amount'] = '库存';
                    seller_tab_list['seller'] = '商家';
                } else {
                    seller_tab_list['seller'] = this.seller_type == 1 ? '企业' : '商家';
                }
                this.common_data.seller_tab.list = seller_tab_list;
            },
            // 设置商家信息，并设置需要依赖商家信息的数据
            setSellerInfo() {
                if (this.seller_user_id) {
                    let data_append = {};
                    if (this.sa_id) {
                        data_append = Object.assign(data_append, {
                            seller_id: this.seller_user_id,
                        })
                    } else {
                        data_append = Object.assign(data_append, {
                            seller_user_id: this.seller_user_id
                        })
                    }
                    this.$api.post(this, {
                        url: '/seller/info/info',
                        data_key: null,
                        data_append: data_append,
                        success: (Result, data_key) => {
                            if (this.$api.form.toast(this, Result, data_key)) return;
                            let seller_info = Result.result;
                            let current_time = this.$nddyny.date.format(new Date(), 'hhmm');
                            if (
                                (seller_info.open_start_time == 0 && seller_info.open_end_time == 0) ||
                                (current_time * 1 >= seller_info.open_start_time * 1 && current_time *
                                    1 <= seller_info.open_end_time * 1)
                            ) {
                                seller_info.open_item = true;
                            } else {
                                seller_info.open_item = false;
                            }
                            this.common_data.seller_info = seller_info;
                            // 更新完商家信息后，需要根据商家信息来决定显示哪些tab页
                            this.setItemTabList();
                        }
                    });
                } else {
                    this.common_data.seller_info = this.$store.state.user.identity_info.seller_info;
                    // 更新完商家信息后，需要根据商家信息来决定显示哪些tab页
                    this.setItemTabList();
                }
            },
            // 用来切换是显示哪种商品列表的tab
            setItemTabList() {
                let item_tab_list = {};
                if (!this.seller_user_id) {
                    item_tab_list['item'] = {
                        title: '全部成品商品'
                    }
                }
                if (this.common_data.seller_info.is_express != 0) {
                    item_tab_list['is_express'] = {
                        title: '全国邮寄'
                    }
                }
                if (this.seller_data.form.is_firm != 1) {
                    if (this.common_data.seller_info.is_same_city != 0) {
                        item_tab_list['is_same_city'] = {
                            title: '同城配送'
                        }
                    }
                    if (this.common_data.seller_info.is_to_shop != 0) {
                        item_tab_list['is_to_shop'] = {
                            title: '到店自取'
                        }
                    }
                }
                this.common_data.item_tab.list = item_tab_list;

                if (this.params.buy_mode && this.$dict.seller_buy_mode_int2key[this.params.buy_mode]) {
                    this.common_data.item_tab.cur = this.$dict.seller_buy_mode_int2key[this.params.buy_mode];
                } else {
                    this.common_data.item_tab.cur = this.$nddyny.object.firstKey(item_tab_list);
                }
            },
            // 初始化全部的商品列表
            itemListInit() {
                // 设置商品属于商家或企业的过滤条件
                this.setDataIsSellerFirm();
                if (!this.seller_user_id) {
                    // 商家管理用- 全部成品商品列表
                    this.allItemListInit();
                    // 商家管理用 - 半成品列表
                    if (this.common_data.seller_tab.cur == 'half') {
                        this.halfInit();
                    }
                }
                // 通用 - 其它商品列表
                this.expressSameCityToShopList();
            },
            // 设置商品属于商家或企业的过滤条件
            setDataIsSellerFirm() {
                if (!this.seller_user_id) {
                    if (this.seller_data.form.is_seller == 1 && this.seller_data.form.is_firm == null) {
                        this.$set(this.data.form, 'is_seller', 1);
                        this.$set(this.data.form, 'is_firm', 0);
                    } else if (this.seller_data.form.is_seller == null && this.seller_data.form.is_firm == 1) {
                        this.$set(this.data.form, 'is_seller', 0);
                        this.$set(this.data.form, 'is_firm', 1);
                    } else if (this.seller_data.form.is_seller == 1 && this.seller_data.form.is_firm == 1) {
                        this.$set(this.data.form, 'is_seller', 1);
                        this.$set(this.data.form, 'is_firm', 1);
                    } else if (this.seller_data.form.is_seller == 0 && this.seller_data.form.is_firm == 0) {
                        this.$set(this.data.form, 'is_seller', null);
                        this.$set(this.data.form, 'is_firm', null);
                    } else if (this.seller_data.form.is_seller != 1 && this.seller_data.form.is_firm != 1) {
                        this.$set(this.data.form, 'is_seller', null);
                        this.$set(this.data.form, 'is_firm', null);
                    } else {
                        this.$set(this.data.form, 'is_seller', this.seller_data.form.is_seller);
                        this.$set(this.data.form, 'is_firm', this.seller_data.form.is_firm);
                    }
                } else {
                    this.$set(this.data.form, 'is_seller', this.seller_type == 0 ? 1 : 0);
                    this.$set(this.data.form, 'is_firm', this.seller_type == 1 ? 1 : 0);
                }
            },
            // 初始化 - 商家管理用 - 全部成品商品列表
            allItemListInit() {
                this.$api.post(this, {
                    url: '/seller/item/list',
                    success: (Result) => {
                        if (this.$api.form.toast(this, Result)) return;

                        // 发货渠道
                        this.seller_data.all_item_list_info.send_channel_list = Result.result.send_channel_list;

                        // 商品类型
                        let item_type_radio_values = {};
                        Result.result.item_type_list.forEach(info => {
                            item_type_radio_values['id_' + info.item_type_id] = info.name;
                        })
                        this.seller_data.all_item_list_info.item_type_radio_values = item_type_radio_values;

                        // 商品列表
                        let item_object = {};
                        let item_list = [];
                        // 因为同一个商品会有多个商品分类，接口返回的列表商品是重复的，所以把商品分类提出来，让商品不重复
                        Result.result.list.forEach(info => {
                            let item_info = item_object[info.item_id];
                            if (!item_info) {
                                item_info = info;
                                item_info.item_type_list = {};
                            }
                            item_info.item_type_list[info.item_type_id] = {
                                item_type_name: info.item_type_name,
                                item_type_is_firm: info.item_type_is_firm,
                                item_type_is_seller: info.item_type_is_seller,
                                item_type_open_status: info.item_type_open_status,
                                item_type_audit_status: info.item_type_audit_status,
                            };
                            item_object[info.item_id] = item_info;
                        })
                        // 增加一个key 用来判断商品是否可见
                        Object.keys(item_object).forEach(key => {
                            let item_info = item_object[key];
                            item_info.open_item = true;
                            // 任意一个商品分类是可见的，商品就是可见的
                            Object.keys(item_info.item_type_list).forEach(ckey => {
                                let item_type_info = item_info.item_type_list[ckey];
                                if (item_type_info.item_type_audit_status == 1 &&
                                    item_type_info.item_type_open_status == 1) {
                                    item_info.is_user_visible = 1;
                                }
                            })
                            if (!item_info.is_user_visible) {
                                item_info.is_user_visible = 0;
                            }
                            if (item_info.item_open_status != 1 ||
                                item_info.item_audit_status != 1 ||
                                item_info.item_attr_open_status != 1 ||
                                item_info.item_attr_audit_status != 1 || (
                                    item_info.is_to_shop != 1 &&
                                    item_info.is_same_city != 1 &&
                                    item_info.is_express != 1
                                )
                            ) {
                                item_info.is_user_visible = 0;
                            }
                        })
                        item_list = Object.values(item_object);
                        this.$nddyny.array.sort(item_list, 'item_sort', 'item_id');
                        this.seller_data.all_item_list_info.item_list_bak = this.$nddyny.object.copy(
                            item_list);
                        this.searchAllItemList(item_list);
                    }
                });
            },
            // 搜索商家用的 全部成品商品列表用的方法
            searchAllItemList(item_list_bak) {
                let item_list = this.$nddyny.object.copy(item_list_bak);
                let item_type_id = this.seller_data.form.item_type_id;
                if (item_type_id) {
                    item_type_id = item_type_id.slice(3);
                }
                item_list.forEach((info, key) => {
                    if (
                        this.seller_data.form.search_value &&
                        info.item_name.toLowerCase().search(this.seller_data.form.search_value) == -1 &&
                        info.content.toLowerCase().search(this.seller_data.form.search_value) == -1
                    ) {
                        delete item_list[key];
                    } else if (
                        this.seller_data.form.buy_mode_field && (
                            (this.seller_data.form.buy_mode_field == 'is_express' && info.is_express == 0) ||
                            (this.seller_data.form.buy_mode_field == 'is_same_city' && info.is_same_city == 0) ||
                            (this.seller_data.form.buy_mode_field == 'is_to_shop' && info.is_to_shop == 0)
                        )
                    ) {
                        delete item_list[key];
                    } else if (
                        item_type_id &&
                        !Object.keys(info.item_type_list).includes(item_type_id)
                    ) {
                        delete item_list[key];
                    }
                });
                this.seller_data.all_item_list_info.item_list = this.$nddyny.array.filterNull(item_list);
            },
            // 初始化半成品商品页面
            halfInit() {
                this.$api.post(this, {
                    url: '/seller/item/notList',
                    data_key: null,
                    success: (Result, data_key) => {
                        if (this.$api.form.toast(this, Result, data_key)) return;
                        this.seller_data.not_item_list = Result.result;
                    }
                });
            },
            // 初始化商品库存页面
            attrAmountListInit(action) {
                this.$api.list(this, {
                    action,
                    url: '/seller/item/attrAmountList',
                    data_key: ['seller_data', 'attr_amount_data'],
                    success: (Result, data_key) => {
                        if (this.$api.form.toast(this, Result, data_key)) return;
                        this.seller_data.attr_amount_data.list = this.seller_data.attr_amount_data.list.concat(
                            Result.result.list);
                    }
                });
            },
            // 强制初始化商品库存页面
            attrAmountListForceInit() {
                this.attrAmountListInit(this.$api.list_action_force_init);
            },
            // 在商品属性页面选择商品属性时触发的，用于确定用户当前选择了哪个属性
            itemAttrChange(attr_checkbox_value_1, attr_checkbox_value_2, attr_checkbox_value_3, item_attr_info) {
                if (!item_attr_info) {
                    this.$set(this.common_data.item_attr_dialog, 'item_info',
                        this.$nddyny.object.copy(this.common_data.item_attr_dialog.item_info_bak));
                    this.$set(this.common_data.item_attr_dialog, 'item_attr_info', null);
                    this.common_data.item_attr_dialog.input_value = 1;
                    this.common_data.item_attr_dialog.input_value_bak = 0;
                    return;
                }
                this.common_data.item_attr_dialog.item_attr_info = item_attr_info;
                let new_item_info = Object.assign({}, this.common_data.item_attr_dialog.item_info, {
                    item_attr_id: item_attr_info.item_attr_id,
                    oprice: item_attr_info.oprice,
                    price: item_attr_info.price,
                    amount: item_attr_info.amount,
                    bonus_gold_coupon_ratio: item_attr_info.bonus_gold_coupon_ratio,
                    logo: item_attr_info.logo,
                    is_appoint_attr: true,
                });
                this.$set(this.common_data.item_attr_dialog, 'item_info', new_item_info);
                if (this.refsCartPageCartItemAttrList[item_attr_info.item_attr_id]) {
                    this.common_data.item_attr_dialog.input_value_bak =
                        this.common_data.item_attr_dialog.input_value =
                        this.refsCartPageCartItemAttrList[item_attr_info.item_attr_id].amount;
                } else {
                    this.common_data.item_attr_dialog.input_value =
                        new_item_info.buy_amount_min > 1 ? new_item_info.buy_amount_min : 1;
                    this.common_data.item_attr_dialog.input_value_bak = 0;
                }
            },
            // 通用的 全国邮寄、同城配送、到店自取 列表初始化方法
            expressSameCityToShopList() {
                this.$api.post(this, {
                    url: '/seller/item/list',
                    data_append: {
                        seller_user_id: this.seller_user_id || this.$store.state.user.identity_info.user_id
                    },
                    success: (Result) => {
                        if (this.$api.form.toast(this, Result)) return;
                        let list_left_object = {
                            is_express_list_left_object: {},
                            is_same_city_list_left_object: {},
                            is_to_shop_list_left_object: {},
                        };
                        let list_right_object = {
                            is_express_list_right: [],
                            is_same_city_list_right: [],
                            is_to_shop_list_right: [],
                        };
                        let item_list = {};
                        let current_time = this.$nddyny.date.format(new Date(), 'hhmm');
                        // 把从接口取到数据，按不同的配送类型加入到不同的数组中
                        Result.result.list.forEach(info => {
                            if (info.open_item !== true && info.open_item !== false) {
                                if (
                                    (info.open_start_time == 0 && info.open_end_time == 0) ||
                                    (current_time * 1 >= info.open_start_time * 1 && current_time *
                                        1 <= info.open_end_time * 1)
                                ) {
                                    info.open_item = true;
                                } else {
                                    info.open_item = false;
                                    info.item_sort *= -1
                                }
                            }
                            if (info.is_express == 1) {
                                list_right_object.is_express_list_right.push(info);
                            }
                            if (info.is_same_city == 1) {
                                list_right_object.is_same_city_list_right.push(info);
                            }
                            if (info.is_to_shop == 1) {
                                list_right_object.is_to_shop_list_right.push(info);
                            }
                            item_list[info.item_id] = info;
                        })
                        this.common_data.item_list = item_list;
                        // 生成不同的配送类型拥有的商品分类
                        let express_same_city_to_shop_array = ['is_express', 'is_same_city', 'is_to_shop'];
                        express_same_city_to_shop_array.forEach(key => {
                            list_right_object[key + '_list_right'].forEach(info => {
                                if (list_left_object[key + '_list_left_object'][info.item_type_id]) {
                                    return;
                                }
                                list_left_object[key + '_list_left_object'][info.item_type_id] = {
                                    item_type_id: info.item_type_id,
                                    name: info.item_type_name,
                                    item_type_sort: info.item_type_sort
                                };
                            })
                        })
                        // 对商品分类和商品列表赋值给对应的对象，用于页面显示
                        this.common_data.is_express_list_info = {
                            list_key: this.common_data.vertical_nav.left_key,
                            list_left: this.$nddyny.array.sort(Object.values(list_left_object.is_express_list_left_object),
                                'item_type_sort', 'item_type_id'),
                            list_right: this.$nddyny.array.sort(Object.values(list_right_object.is_express_list_right),
                                'item_sort', 'item_id'),
                        };
                        this.common_data.is_same_city_list_info = {
                            list_key: this.common_data.vertical_nav.left_key,
                            list_left: this.$nddyny.array.sort(Object.values(list_left_object.is_same_city_list_left_object),
                                'item_type_sort', 'item_type_id'),
                            list_right: this.$nddyny.array.sort(Object.values(list_right_object.is_same_city_list_right),
                                'item_sort', 'item_id'),
                        };
                        this.common_data.is_to_shop_list_info = {
                            list_key: this.common_data.vertical_nav.left_key,
                            list_left: this.$nddyny.array.sort(Object.values(list_left_object.is_to_shop_list_left_object),
                                'item_type_sort', 'item_type_id'),
                            list_right: this.$nddyny.array.sort(Object.values(list_right_object.is_to_shop_list_right),
                                'item_sort', 'item_id'),
                        };
                        if (this.params.item_id) {
                            let item_id = this.params.item_id;
                            this.params.item_id = '';
                            if (this.common_data.item_list[item_id]) {
                                this.$nextTick(() => {
                                    this.itemInfoDialogShow(this.common_data.item_list[item_id]);
                                })
                            } else {
                                this.$store.commit('userToastNone', '商品不存在');
                            }
                        }
                    }
                });
            },
            // 显示展示商品属性的页面
            itemAttrDialogShow(item_info) {
                this.user_data.cart.show = false;
                this.common_data.item_info_dialog.show = false;
                this.common_data.item_attr_dialog.show = true;
                this.common_data.item_attr_dialog.input_value = 1;
                this.common_data.item_attr_dialog.input_value_bak = 0;
                this.$set(this.common_data.item_attr_dialog, 'item_attr_info', null);
                this.common_data.item_attr_dialog.item_info = this.$nddyny.object.copy(item_info);
                this.common_data.item_attr_dialog.item_info_bak = Object.assign({}, this.$nddyny.object.copy(item_info), {
                    is_appoint_attr: false,
                });
                // 查找商品的全部属性，通过get_list_key参数，让接口只返回商品属性列表
                this.$api.post(this, {
                    url: '/seller/item/info',
                    data_key: null,
                    data_append: {
                        item_id: item_info.item_id,
                        seller_user_id: this.seller_user_id,
                        seller_type: this.seller_type,
                        get_list_key: 'item_attr',
                    },
                    success: (Result, data_key) => {
                        if (this.$api.form.toast(this, Result, data_key)) return;
                        this.$set(this.common_data.item_attr_dialog, 'item_attr_list',
                            this.$nddyny.object.copy(Result.result.item_attr_list))
                        this.$set(this.common_data.item_attr_dialog, 'item_attr_list_bak',
                            this.$nddyny.object.copy(this.common_data.item_attr_dialog.item_attr_list));
                    }
                });
            },
            // 商品详情
            itemInfoDialogShow(item_info) {
                if (this.common_data.item_info_dialog.show == true) {
                    return;
                }
                this.$set(this.common_data.item_info_dialog, 'show', true);
                this.common_data.item_info_dialog.item_info = item_info;
            },
            // 显示购物车
            cartListShow() {
                if (this.refsCartPageItemAttrLength > 0 && this.user_data.cart.show == false) {
                    this.$set(this.user_data.cart, 'show', true);
                } else {
                    this.$set(this.user_data.cart, 'show', false);
                }
            },
            // 修改购物车
            itemAttrCartUpdate(crud_type, item_info, item_attr_id, input_item_amount) {
                if (!this.common_data.seller_info.open_item) {
                    this.$store.commit('userToastNone', '不在营业时间');
                    return;
                }
                this.$refs.cart.itemAttrCartUpdate(crud_type, item_info, item_attr_id, input_item_amount);
                if (this.common_data.item_attr_dialog.show == true) {
                    this.common_data.item_attr_dialog.show = false;
                }
            },
            // 清空购物车
            itemAttrCartClear() {
                this.$refs.cart.itemAttrCartClear();
                this.$set(this.user_data.cart, 'show', false);
                this.$set(this.user_data.cart, 'clear_show', false);
            },
            // 需要刷新商品时触发
            setItemCommandRefreshDialog(message) {
                this.item_command_refresh_dialog.show = true;
                this.item_command_refresh_dialog.content = message;
                this.item_command_refresh_dialog.confirm = () => {
                    this.item_command_refresh_dialog.show = false;
                    this.itemListInit();
                }
            },
            // 去结算
            gotoPay() {
                let data = this.$refs.cart.getCartItemAttrList();
                this.$store.commit(
                    'userNavTo',
                    '/seller/item/pay?buy_mode=' + this.buy_mode +
                    '&items=' + this.seller_user_id + ':' + Object.keys(data).join(',')
                )
            }
        },
    }
</script>
<style lang="less">
    #seller-item-list {
        .bg-cart-icon-gray {
            background-color: #363636;
            color: #5f5f63;
        }

        .bg-cart-submit-gray {
            background-color: #535356;
        }
    }
</style>
